<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>年会抽奖</title>
  <style>
    .wrapper {
      width: 840px;
      height: 420px;
      background: url(./images/bg01.jpg) no-repeat center / cover;
      padding: 100px 250px;
      box-sizing: border-box;
    }
  </style>
</head>

<body>
  <div class="wrapper">
    <strong>传智教育年会抽奖</strong>
    <h1>一等奖：<span id="one">???</span></h1>
    <h3>二等奖：<span id="two">???</span></h3>
    <h5>三等奖：<span id="three">???</span></h5>
  </div>
  <script>
    let name = ['allen', 'jerny', 'walker']
    const array = document.querySelectorAll('.wrapper span')
    for (let index = 0; index < array.length; index++) {
      if (name.length > 1) {
        const numIndex = Math.floor(Math.random() * name.length)
        array[index].innerHTML = name[numIndex]
        name.splice(numIndex,1)
      }
      else {
        array[index].innerHTML = name[0]
      }



    }
  </script>
  <script>

  </script>
</body>

</html>